#!/bin/bash

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc
sed -i '177s/.//'dd /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
echo "KEYMAP=us" >> /etc/vconsole.conf
echo "arch" >> /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1       localhost" >> /etc/hosts
echo "127.0.1.1 arch.localdomain arch" >> /etc/hosts
echo root:password | chpasswd
echo "Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch" > /etc/mirrorlist
echo "Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch" >> /etc/mirrorlist

# You can add xorg to the installation packages, I usually add it at the DE or WM install script
# You can remove the tlp package if you are installing on a desktop or vm

pacman -S grub efibootmgr networkmanager network-manager-applet iwd \
    mtools dosfstools reflector base-devel linux-headers avahi xdg-user-dirs xdg-utils \
    gvfs gvfs-smb nfs-utils inetutils dnsutils bluez bluez-utils cups hplip alsa-utils \
    pipewire pipewire-alsa pipewire-pulse pipewire-jack bash-completion openssh rsync \
    reflector acpi acpi_call tlp virt-manager qemu qemu-arch-extra edk2-ovmf bridge-utils \
    dnsmasq vde2 openbsd-netcat iptables-nft ipset firewalld flatpak sof-firmware nss-mdns \
    acpid os-prober ntfs-3g noto-fonts-extra noto-fonts-emoji noto-fonts-cjk noto-fonts \
    wqy-microhei wqy-zenhei wqy-bitmapfont adobe-source-han-sans-cn-fonts adobe-source-han-sans-tw-fonts \
    adobe-source-han-serif-cn-fonts adobe-source-han-serif-tw-fonts ttf-ms-fonts ttf-mac-fonts \
    ttf-dejavu ttf-bitstream-vera artwiz-fonts lm_sensors

# pacman -S --noconfirm xf86-video-amdgpu
# pacman -S --noconfirm nvidia nvidia-utils nvidia-settings

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

systemctl enable NetworkManager
systemctl enable bluetooth
systemctl enable cups.service
systemctl enable sshd
systemctl enable avahi-daemon
systemctl enable tlp # You can comment this command out if you didn't install tlp, see above
systemctl enable reflector.timer
systemctl enable fstrim.timer
systemctl enable libvirtd
systemctl enable firewalld
systemctl enable acpid

useradd -m yamcha
echo user:password | chpasswd
usermod -aG libvirt yamcha

echo "yamcha ALL=(ALL) ALL" >> /etc/sudoers.d/yamcha


printf "\e[1;32mDone! Type exit, umount -a and reboot.\e[0m"




